import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ButtonBar 组件',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('ButtonBar 组件'),
          body:DemoPageState(),
        ),
      ),
    );
  }
}

class DemoPageState extends StatefulWidget{
  @override
  DemoPageState ceateState() => DemoPageState();
}

class DemoPageState extends State<DemoPage>{
  @override
  Widget build(BuildContext context) {
    return Center(
      //针对一排按钮处理
      child: ButtonBar(
        alignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.max,
        children: [
          RaisedButton(onPressed: (){},child: Text('1'),color:Colors.green),
          RaisedButton(onPressed: (){},child: Text('2'),color:Colors.green),
          RaisedButton(onPressed: (){},child: Text('3'),color:Colors.green),
        ],
      ),
    );
  }
}